package demo2;

import java.util.Scanner;

public class Test4 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int q = in.nextInt();
        int[][] arr = new int[q][3];
        for(int i = 0; i < q; i++) {
            for(int j = 0; j < 3; j++) {
                arr[i][j] = in.nextInt();
            }
        }

        Integer a = 0;
        int c = 12;
        if (a == c) {

        }

        int count = 0;
        for(int i = 0; i < q; i++) {
            int min = arr[i][0] < arr[i][1] ? arr[i][0] : arr[i][1];
            min = min < arr[i][2] ? min : arr[i][2];

            if(min == arr[i][1]) {
                count = 2*min;
            }

            else if(min == arr[i][0]) {
                count = 2*min + arr[i][1]-min-1;
            }

            else if(min == arr[i][2]) {
                count = 2*min + arr[i][1]-min-1;
            }

            System.out.println(count);
        }
    }
}
